package com.cy.pj.sys.web.controller;

import com.cy.pj.common.pojo.JsonResult;
import com.cy.pj.common.util.PageUtil;
import com.cy.pj.sys.pojo.SysRole;
import com.cy.pj.sys.service.SysRoleService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/role/")
public class SysRoleController {
    @Autowired
    private SysRoleService sysRoleService;
    @GetMapping
    public JsonResult doFindRoles(SysRole sysRole, HttpServletRequest request){
     /*   String pageCurrentStr = request.getParameter("pageCurrentStr");
        String pageSizeStr = request.getParameter("pageSizeStr");
        Integer pageCurrent=pageCurrentStr==null||pageCurrentStr.length()==0?1:Integer.parseInt(pageCurrentStr);
        Integer pageSize=pageSizeStr==null||"".equals(pageSizeStr)?4:Integer.parseInt(pageSizeStr);
        PageInfo<Object> pageInfo = PageHelper.startPage(pageCurrent, pageSize).doSelectPageInfo(() -> sysRoleService.findRoles(sysRole));
        return new JsonResult(pageInfo);*/
        return new JsonResult(PageUtil.startPage().doSelectPageInfo(()->sysRoleService.findRoles(sysRole)));
    }
}
